[Qt] How to make another window pop up that extends QWidget as opposed to QDialog?

Posted by Graphics Noob on Stack Overflow See other posts from Stack Overflow or by Graphics Noob
Published on 2010-05-12T21:23:45Z Indexed on 2010/05/12 21:54 UTC
Read the original article Hit count: 173

Filed under:
|

So far I've only had my main window pop up other windows that were QDialogs and I'm not getting it to work with a QWidget. The other window I want to display was designed with the Form Editor, then wrapped in a class called ResultViewer which extends QWidget (as opposed to QDialog). What I want is to have the ResultViewer show its ui in a seperate window. Now when I try to display it the ResultViewer ui just pops up in the main window on top of the mainwindow ui.

The code I'm using to display it is this (in my mainwindow.cpp file)

ResultViewer * rv = new ResultView(this);
rv->show();

The constructor for the ResultViewer looks like this

ResultViewer::ResultViewer(QWidget * parent) :
    QWidget(parent),
    ui(new Ui::ResultViewer)
{
    ui->setupUi(this);
}

I've looked through the QWidget documentation a bit but the only thing I can find that may be related is the QWidget::window() function, but the explanation isn't very clear, it just gives an example of changing the title of a window.

© Stack Overflow or respective owner

Related posts about qt

Related posts about gui